import 'package:flutter/material.dart';

void main() {
  runApp(MaterialApp(
      home: Scaffold(
    appBar: AppBar(
      title: const Text("你好flutter"),
    ),
    body: const MyApp(),
  )));
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return GridView.count(
      crossAxisCount: 4,
      children: const [
        IconButton(
          icon: Icons.shop,
          color: Colors.lightBlue,
        ),
        IconButton(
          icon: Icons.house,
          color: Colors.lightGreen,
        ),
        IconButton(
          icon: Icons.fire_truck,
          color: Colors.red,
        ),
        IconButton(
          icon: Icons.settings,
          color: Colors.orange,
        ),
        IconButton(
          icon: Icons.logout,
          color: Colors.cyan,
        ),
        IconButton(
          icon: Icons.star,
          color: Colors.yellow,
        ),
        IconButton(
          icon: Icons.delete,
          color: Colors.lightGreen,
        ),
        IconButton(
          icon: Icons.rule,
          color: Colors.lightBlue,
        ),
        IconButton(
          icon: Icons.timeline,
          color: Colors.lightGreen,
        ),
        IconButton(
          icon: Icons.access_alarm,
          color: Colors.lightBlue,
        ),
      ],
    );
  }
}

class IconButton extends StatelessWidget {
  final Color color;
  final double size;
  final IconData icon;
  const IconButton(
      {super.key,
      required this.icon,
      this.color = Colors.blue,
      this.size = 32.0});

  @override
  Widget build(BuildContext context) {
    return Container(
      height: 100.0,
      width: 100.0,
      color: color,
      child: Center(
        child: Icon(icon, size: size, color: Colors.white),
      ),
    );
  }
}
